package a10_StreamIO;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

/**
 * @Author quan
 * @Description TODO
 * @Date 2023/5/24 17:06
 */
public class a05_FileWriter {
    public static void main(String[] args) throws IOException {
        //1、创建一个File对象
        File file = new File("D:/hello.txt");
        //2、根据文件对象创建一个字符输出流
        FileWriter writer = new FileWriter(file);
        //3、写入内容
        writer.write("今天是周三\n");
        writer.write("怎么才周三呢");
        //4、强制刷新缓冲区
        writer.flush();
        //5、关闭流
        writer.close();
    }
}
